import pytest
import time
import os
from common.email_handle import EmailHandler


if __name__ == '__main__':
    time_name = "test{}.html".format(time.strftime("%Y_%m_%d %H_%M_%S", time.localtime()))
    # pytest.main(["-m", 'debug',
    #              r"--html=test_report/test{}".format(time_name),
    #              "--self-contained-html",
    #              "--capture=sys"])

    pytest.main(["-vs", r"--html=test_report/test{}".format(time_name), '--alluredir=./reports', "--no-summary"])

    #使用allure命令生成测试报告 ：allure generate 数据路径文件 -o html路径文件 -c
    cmd = 'allure generate ./reports -o ./reports/allure --clean'
    os.system(cmd)

    # 发送邮件
    # EmailHandler().send_email(res_email="1262613566@qq.com,526041358@qq.com")

